#ifndef USERINFO_H
#define USERINFO_H

#include <QWidget>
#include <QTableView>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QMessageBox>
#include <QSqlTableModel>
#include "database.h"
#include "changepasswordwindow.h"
#include "historywindow.h"

class UserInfo : public QWidget
{
    Q_OBJECT

public:
    explicit UserInfo(const QString &username, Database *db, QWidget *parent = nullptr);
    ~UserInfo();

private slots:
    void onChangePasswordClicked();
    void onHistoryClicked();

private:
    void setupUI();
    void createConnections();
    void setupTableModel();

    QString username;
    Database *db;
    QTableView *borrowTableView;
    QPushButton *changePasswordButton;
    QPushButton *historyButton;
    QSqlTableModel *borrowModel;
};

#endif // USERINFO_H 
